﻿namespace Carer.App.Filter
{
    using System.Web;
    using System.Web.Mvc;

    public class SessionExpireFilterAttribute : ActionFilterAttribute
    {
        public SessionExpireFilterAttribute()
        {
            
        }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            string str = filterContext.RouteData.Values["Controller"].ToString();
            string str2 = filterContext.RouteData.Values["Action"].ToString();
            if ((str != "Home") || ((str2 != "Login") && (str2 != "logout")))
            {
                HttpContext current = HttpContext.Current;
                if ((current.Session != null) && current.Session.IsNewSession)
                {
                    string str3 = current.Request.Headers["Cookie"];
                    if ((str3 != null) && (str3.IndexOf("ASP.NET_SessionId") >= 0))
                    {
                        //current.Response.Redirect("~/Home/Login");
                    }
                }
            }
        }
    }
}

